﻿<%@ Page Title="<% $Resources:PageTitle %>" Language="C#" MasterPageFile="~/MasterPages/Core.Master" AutoEventWireup="true" 
    CodeBehind="Settings.aspx.cs" Inherits="Pap.Web.Modules.Administration.Views.Settings" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <style type="text/css">
        div.x-grid3-cell-inner
        {
            height: 30px !important;
            white-space: normal;
        }
    </style>
    <ext:TokenScript runat="server">
    <script type="text/javascript">
        var changedData = [];

        function handleChange(source, recordId, value, oldValue) {                
            var index = -1;

            for (var i = 0; i < changedData.length; i++) {
                if (changedData[i].label == recordId) {
                    index = i;
                    break;
                }
            }

            if (value.getDate)
                value = value.format("m/d/Y");
                
            if (index < 0) {
                changedData.push({ label: recordId, value: value });
            }
            else {
                changedData[index] = { label: recordId, value: value };
            }

        }

        function btnSaveClicked() {
            var strDataChanges = Ext.encode(changedData);
            Pap.saveSettings(strDataChanges);
        }
    </script> </ext:TokenScript>
    <ext:Store ID="committeesStore" runat="server">
        <Reader>
            <ext:JsonReader>
                <Fields>
                    <ext:RecordField Name="CommitteeName" />
                    <ext:RecordField Name="CommitteeID" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:FitLayout runat="server">
        <ext:FormPanel runat="server">
            <Body>
                <ext:FormLayout runat="server">
                    <%--<ext:Anchor Horizontal="50%">
                        <ext:ComboBox runat="server" ID="comboCommittees" Editable="false" TypeAhead="true"
                            StoreID="committeesStore" DisplayField="CommitteeName" ValueField="CommitteeID"
                            Mode="Local" ForceSelection="true" TriggerAction="All" SelectOnFocus="true" meta:resourcekey="comboCommitteesResource"
                            EmptyText="No Committee Selected...">
                            <AjaxEvents>
                                <Select OnEvent="comboItemSelected" />
                            </AjaxEvents>
                        </ext:ComboBox>
                    </ext:Anchor>--%>
                    <ext:Anchor Horizontal="90%" Vertical="94%">
                        <ext:TabPanel runat="server" ID="tabPanelCategories" AutoWidth="true" StateEvents="true">
                            <BottomBar>
                                <ext:StatusBar runat="server">
                                    <Items>
                                        <quadz:CoolitePermitButton runat="server" ID="btnSave" Text="Save" Icon="Disk" PermissionName="SaveSettings"
                                            HideAsDisabled="true">
                                            <Listeners>
                                                <Click Fn="btnSaveClicked" />
                                            </Listeners>
                                        </quadz:CoolitePermitButton>
                                    </Items>
                                </ext:StatusBar>
                            </BottomBar>
                        </ext:TabPanel>
                    </ext:Anchor>
                </ext:FormLayout>
            </Body>
        </ext:FormPanel>
    </ext:FitLayout>
</asp:Content>
